// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "AttributeSet.h"
#include "AbilitySystem/AuraAttributeSet.h"
#include "UI/WidgetController/AuraWidgetController.h"
#include "AttributeMenuWidgetController.generated.h"

class UAttributeInfo;
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FAttributeInformationDelegate, const FAttributeInformation&, Information);

/**
 * 属性菜单控件控制器,检测数值变化,广播给控件
 */
UCLASS(BlueprintType, Blueprintable)
class AURA_API UAttributeMenuWidgetController : public UAuraWidgetController
{
	GENERATED_BODY()

	/** 广播属性信息 */
	void BroadcastAttributeInformation(
		const FGameplayTag& Tag, const FGameplayAttribute& Attribute, const UAuraAttributeSet* AuraAttributeSet
	) const;

public:

	/** 用于传递属性信息的委托,在蓝图分配事件实现UI更新 */
	UPROPERTY(BlueprintAssignable, Category = "GAS|Attributes")
	FAttributeInformationDelegate AttributeInformationDelegate;

	/** 绑定相关回调,如绑定Model层变化回调 */
	virtual void BindCallbacksToDependencies() override;

	/** 蓝图设置静态属性数据  */
	UPROPERTY(EditDefaultsOnly)
	TObjectPtr<UAttributeInfo> AttributeInfo;

	/** 广播初始值 */
	UFUNCTION(BlueprintCallable)
	virtual void BroadcastInitialValues() override;
};
